<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<f:view>

	<a4j:keepAlive beanName="yahooImportBean"/>

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>EvIn | Contacts</title>
            <link rel="stylesheet" href="/EvIn/styles/styles.css" type="text/css" />

			<script type="text/javascript">
				function goToResult(doGo){
					if(doGo){
						var f=document.forms['go_to_contacts'];
						f.submit();
					}
				}
			</script>
        </head>

        <body>

            <div id="wrapper">
                <div class="header">
                    <jsp:include page="/common/header.jsp"></jsp:include>
                </div>
                <div class="fullpane">
                    <div class="leftpane">
                        <jsp:include page="/common/main_menu.jsp"></jsp:include>
                    </div>

                    <div class="rightpane">

                        <div class="contentTitle">
							Import contacts
                        </div>
                        <br/>



						In order to import your Yahoo! contacts you need to do the following:<br/>
						<ul>
							<li>Go to your Yahoo! mail</li>
							<li>Go to <i>Contacts</i></li>
							<li>Click <i>Tools -> Export</i></li>
							<li>Click  <i>Export Now</i> next to <i>Yahoo! CSV</i></li>
							<li>Upload here the file that you receive from Yahoo!</li>
						</ul>

						<form name="go_to_contacts" action="/EvIn/user/contacts.faces" method="get">
						</form>

						<div align="center">
							<h:form id="loading_status" >
								<h:graphicImage url="/static/images/loading.gif" rendered="#{yahooImportBean.importStarted && not yahooImportBean.importFinished}"/>
								<br/>
								<br/>
								<h:outputText value="Importing Yahoo contacts..." rendered="#{yahooImportBean.importStarted && not yahooImportBean.importFinished}"/>
							</h:form>
						</div>

						<h:form>
							<a4j:poll id="polling1"  enabled="#{true}" interval="500" reRender="loading_status" oncomplete="goToResult(#{yahooImportBean.importFinished})">
							</a4j:poll>
						</h:form>

						<div align="center">	

							<rich:fileUpload id="file_uploader" acceptedTypes="csv" maxFilesQuantity="1" fileUploadListener="#{yahooImportBean.uploadListener}" listHeight="60" rendered="#{not yahooImportBean.fileReceived}"></rich:fileUpload>
						</div>

                    </div>
                </div>
            </div>
        </body>
    </html>

</f:view>

